package com.sailorj.mapper;

import com.sailorj.entity.TbPlan;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TbPlanMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(TbPlan record);

    int insertSelective(TbPlan record);

    TbPlan selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbPlan record);

    int updateByPrimaryKey(TbPlan record);

    @Select(value = "update tb_plan SET is_num=#{num}  where  id =#{id} and is_delete = 0 ")
    int updatePlanSumById(int id,String num);

    @Select("select * from tb_plan where is_delete = 0 limit #{page},#{size}")
    List<TbPlan> selectPlanList(@Param("page") Integer page, @Param("size")Integer size);

    @Select(value = "select * from tb_plan t where t.lab_name=#{planName} and is_delete = 0 ")
    TbPlan findPlanByName(String name);

    @Select(value = "select * from tb_plan t where t.id=#{id} and is_delete = 0 ")
    TbPlan findPlanByid(int id);

    //setIsExamine/是否审核,0-待审核，1-已通过，2-未通过
    @Select("select * from tb_plan t where t.is_examine=1 and is_delete = 0 limit #{page},#{size}")
    List<TbPlan> getPlanListOne(@Param("page") Integer page, @Param("size")Integer size);

    @Select("select count(*) from tb_plan")
    Long getTotal();
}